<?php
	$kq=$knoi->queryCsdl("select * from nganhnghe");
	if(mysql_num_rows($kq)>0)
	{
		$tongdong=mysql_num_rows($kq);
		$dong_trang=9;
		$sotrang=ceil($tongdong/$dong_trang);
		
		$limit="0,".$dong_trang;
		if(isset($_GET['page']))
		{
			$t=$_GET['page'];
			$ar=explode(":",$t);
			$limit=$ar[1];
		}
		if($sotrang>1)
			$kq=$knoi->queryCsdl("select * from nganhnghe limit $limit");
				?>
	<p class="styletitle" align="center">DANH SÁCH NGÀNH NGHỀ</p>
		<table align="center" style="border:solid #FFFFFF; background-color:#F5F5F5">
			<tr class="stylelitle" style="text-align:center; background-color:#CCFFFF"><td width="6%">Stt</td>
			<td width="63%">Tên ngành</td>
			<td width="18%">Mã ngành</td>
			<td width="8%">Chi tiết</td>
			<td width="5%">Xóa</td>
			</tr>
			<?php
			$i=1;
			if(isset($_GET['i']))
				$i=$_GET['i'] + 1;
			while($n=mysql_fetch_array($kq))
			{
				if($i%2==0)
					$color='#FFFFCC';
				else
					$color='#FFFFFF';
		?>
					<tr class="classtr"  style="background-color:<?php echo $color; ?>; text-align:left;"><td align="right"><?php echo $i; ?>&nbsp;</td><td>&nbsp;<?php echo $n['tennganh']; ?></td><td style="text-align:center"><?php echo $n['manganh']; ?></td><td style="text-align:center"><a  href="home_admin.php?module=thongtinnganhnghe&manganh=<?php echo $n['manganh']; ?>"><img src="images/chitiet.png" border="0" title="Chi tiết ngành nghề" /></a></td><td style="text-align:center"><a href="home_admin.php?module=xoa&field=manganh&table=nganhnghe&value=<?php echo $n['manganh']; ?>"><img src="images/Sign-Error-icon1.png" border="0" title="Xóa ngành nghề kinh doanh" /></a></td></tr>
			<?php
				$i++;	
				}
			?>
		</table>
	<?php
	if($sotrang>1)
	{
		 	if($ar[0]!=1 && isset($_GET['page']))
				$color='#0033CC';
			else
				$color='#000000';
			$start="1:0,".$dong_trang;
			?>
			<div> Pages &nbsp;
			<?php
				echo "<a href='home_admin.php?module=danhsachnganhnghe&page=$start' style='color:$color'>1</a>";
			for($i=2;$i<=$sotrang;$i++)
			{
				if($ar[0]==$i)
					$color='#000000';
				else
					$color='#0033CC';
				$p=($i-1)*$dong_trang;
				$page=$i.":".$p.",".$dong_trang;
				echo "&nbsp;<a href='home_admin.php?module=danhsachnganhnghe&page=$page&i=$p' style='color:$color'>$i</a>";	
			}
			echo "<br>";
		}
	}
	else
		echo "<label class='stylelitle'>Hiện tại công ty chưa có ngành nghề nào!</label><br>";
	?>
		<br>
		<label style="text-align:center" class="button"><a class="menulink" href="home_admin.php?module=themnganhnghe"><img src="images/add.png" border="0">&nbsp;Ngành nghề mới</a></label>

